package cn.tedu.spring.life;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Component
public class Life {
    private String meaning;

    public Life() {
        System.out.println("1:实例化阶段【调用无参构造】");
    }
    @Value("生活就是学习")
    public void setMeaning(String meaning) {
        this.meaning=meaning;
        System.out.println("2:依赖注入阶段【调用set方法】");
    }
    @PostConstruct
    public void init(){
        System.out.println("3:初始化阶段【调用init方法】");
    }
   @PreDestroy
    public void destroy(){
        System.out.println("5:销毁阶段【调用destroy方法】");
    }
}
